package the.guanzhong.express.infrastructure.common.enums;

import lombok.Getter;

import java.util.Arrays;

public enum RefundResultEnum {

    SUCCESS(10, "退款成功"),
    FAIL(20, "退款失败");

    RefundResultEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    @Getter
    private Integer code;

    @Getter
    private String name;

    public static String getName(Integer code) {
        return code == null ? "" : Arrays.stream(RefundResultEnum.values()).filter(it -> it.getCode().equals(code)).findFirst().get().getName();
    }
}
